<template>
	<div class="cell" @click="toWhere">
		
		<div class="left">
			{{title}}
		</div>
		
		<div class="right">
			{{value}}
			<i class="iconfont icon-arrow-right"></i>
		</div>
	
	</div>
</template>

<script>
	export default {
		props: {
			title: {
				type: String,
				required: true
			},
			value: String,
			to: String
			
		},
		
		methods: {
			
			
			//预留到父组件的回调函数
			toWhere(e){
				//如果传过来有to属性就跳转，否则回传
				if(this.to){
					this.$router.push({ path: this.to })
					return;
				}
				this.$emit("click" , e);
			}
		}
	}
</script>

<style lang="less" scoped>
	.cell{
		height: 50px;
		font-size: 15px;
		border-bottom: 1px solid #ddd;
		margin: 0px 20px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		
		.left{
			
		}
		.right{
			color: #666666;
			font-size: 13px;
		}
	}
</style>